# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

  def tag_cloud
    @tags=Tag.find(:all).sort_by{|t| t.tagged.size}
    @top_tag_count=@tags.last.tagged.size
    @tags=@tags[@tags.size-30..@tags.size].sort_by{|t| t.name}
    render :partial=>"shared/tag_cloud"
  end

  def rss_link_generator(tags, authority, combinetype)
   # link_string=link_to(image_tag("rss.png", :border=>"0", :title=>"subscribe to a feed of posts from blogs in this selection"), :controller=>"blogs", :action=>"rss", :tags=>tags, :authority=>authority, :combine_type=>combinetype)
    link_string=url_for( :controller=>"blogs", :action=>"rss", :authority=>authority, :combine_type=>combinetype)
    if tags
      tags.each do |tag|
       link_string<<"&tags[]=#{tag}"
      end
    end
    "<a href=\"#{link_string}\">"+image_tag("rss.png", :border=>"0", :title=>"subscribe to a feed of posts from blogs in this selection")+"</a>"
  end 
end
